<div class="tableform">
<form action="index.php?app=ome&ctl=admin_stock&act=search" id="formid" method="post">
<h3>库存查询</h3>
<div class="division">
<table>
    <tr>
        <td>
	      <div style="position:relative">
            请录入货号或者商品名称： &nbsp;&nbsp;&nbsp;
	        <input type="text" id="stock_search" name="stock_search" value="<{$keywords}>" />
            <{button label="查询" type="submit" id="btn_search"}>
          </div>
        </td>
    </tr>
</table>
</div>

<div class="division">
<table class="gridlist" cellpadding="0" cellspacing="0">
    <thead>
        <tr>
            <th>货号</th>
            <th>货品名称</th>
            <th>规格</th>
            <th>仓库名</th>
            <th style="display:none;">数量(最大/实际)</th>
            <th>实际库存</th>
        </tr>
    </thead>
    <{if $data}>
    <tbody>
    <{foreach from=$data item=product}>
      <tr>
        <td><{$product.bn}></td>
        <td><{$product.name}></td>
        <td><{$product.spec_info|default:'-'}></td>
        <td><{$product.branch|default:'-'}></td>
        <td style="display:none;"><{$product.max_store|default:0}>/<{$product.store|default:0}></td>
        <td><{$product.store|default:0}></td>
      </tr>
    <{/foreach}>
    </tbody>
    <{/if}>
</table>
</div>
</form>
</div>
<script>
(function(){
    new Autocompleter.script($E('#stock_search'),"index.php?app=ome&ctl=admin_stock&act=getProductsByAuto", {
        'getVar':'stock_search',
        'fxOptions':false,
        callJSON:function(){return window.autocompleter_json;},
        injectChoice:function(json){
            var choice = new Element('li', {'html': this.markQueryValue(json[this.options.getVar])});
            choice.inputValue = json[this.options.getVar];
            this.addChoiceEvents(choice).inject(this.choices);
        }
    });


})();
</script>
